<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- 就地复用虽然可以让vue性能提升，但是有些时候会让视图就会有问题 -->
    <!-- 实际项目中有时候就地复用可能会让代码出问题，不符合需求 -->
    <!-- 1. 先准备一个容器 -->
    <div id="app">
      <button @click="fn">翻转</button>
      <ul>
        <li v-for="item in list">
          <input type="checkbox" />
          {{item.name}}
        </li>
      </ul>
    </div>
    <!-- 2. 引框架 -->
    <script src="./vue.js"></script>
    <script>
      // 3.初始化vue实例对象
      const vm = new Vue({
        el: "#app",
        data: {
          list: [
            { id: 1, name: "张三" },
            { id: 2, name: "李四" },
            { id: 3, name: "王五" },
          ],
        },
        methods: {
          fn() {
            this.list.reverse();
          },
        },
      });
    </script>
  </body>
</html>
